﻿using System;

namespace XSerialization
{
    
    /// <summary>
    /// Custom attribute to map between the XML schema system and the common language runtime. 
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public class XBindingElement : XBinding, IXBinding
    {
        /// <summary>
        /// Ctor for simple Objects like string, class or enum.
        /// </summary>
        /// <param name="xmlName">Name of the Xml Element</param>
        /// <param name="isRequired">Is the Xml Element required?</param>
        /// <param name="sequenceIndex">Index of Element in the xml sequence</param>
        public XBindingElement(string xmlName, bool isRequired, uint sequenceIndex) : base(xmlName, false, isRequired, sequenceIndex, null) { }

        /// <summary>
        /// Ctor for complex Objects like IList or Interfaces
        /// </summary>
        /// <param name="xmlName">Name of the Xml Element</param>
        /// <param name="isRequired">Is the Xml Element required?</param>
        /// <param name="sequenceIndex">Index of Element in the xml sequence</param>
        /// <param name="objectType">Specific Type</param>
        public XBindingElement(string xmlName, bool isRequired, uint sequenceIndex, Type objectType) : base(xmlName, false, isRequired, sequenceIndex, objectType) { }
    }

    /// <summary>
    /// Custom attribute to map between the XML schema system and the common language runtime. 
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public class XBindingAttribute : XBinding, IXBinding
    {
        /// <summary>
        /// Ctor for simple Objects like string or enum.
        /// </summary>
        /// <param name="xmlName">Name of the Xml Attribute</param>
        /// <param name="isRequired">Is the Xml Attribute required?</param>
        /// <param name="sequenceIndex">Index of Attribute in the xml sequence</param>
        public XBindingAttribute(string xmlName, bool isRequired, uint sequenceIndex) : base(xmlName, true, isRequired, sequenceIndex, null) { }
    }
}
